package cn.edu.zsc.blms.domain;

import cn.edu.zsc.blms.util.DateUtil;

import java.util.Objects;

public class Reader extends BaseEntity{
    public static int idCounter = 0;
    public String name;
    public String phone;
    public boolean disable;

    public Reader(){
        this.id = idCounter++;
        this.name = "null";
        this.phone = "null";
        this.disable = false;
    }
    public Reader(String name,String phone){
        this();
        this.name = name;
        this.phone = phone;
    }
    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Reader reader = (Reader) o;
        return disable == reader.disable && Objects.equals(name, reader.name) && Objects.equals(phone, reader.phone);
    }
    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), name, phone, disable);
    }
    public String toString() {
        return "ID: "  + id + ", 姓名: " + name + ", 电话: " + phone + ", 禁用: " + (disable ? "是" : "否");
    }
}
